<template>
  <div
    class="m-select"
    :class="type === 'grey' ? 'grey-class' : 'default-class'"
  >
    <Select v-bind="$attrs" v-on="$listeners" :style="{ width: width + 'px' }">
      <Option
        v-for="(item, index) in options"
        :key="index"
        :label="item.label"
        :value="item.value"
      />
    </Select>
  </div>
</template>

<script>
import { Select, Option } from "element-ui"

export default {
  name: "MSelect",
  components: { Select, Option },
  props: {
    options: Array,
    width: String,
    type: {
      type: String,
      default: "default"
    }
  }
}
</script>

<style lang="scss" scoped>
@import "~@/assets/style/common.scss";

.el-select-dropdown__list {
  .el-select-dropdown__item {
    font-size: 16px;
    box-sizing: content-box;
    padding-top: 5px;
    padding-bottom: 5px;

    &.selected {
      color: $theme-color-1;
    }
  }
}

// 默认type
.default-class {
  /deep/ .el-input__inner {
    height: 45px;
    background-color: $theme-color-1;
    border: none;
    border-radius: 10px;
    color: #fff;

    .el-select__caret {
      color: #fff;
    }

    &::placeholder {
      color: #fff;
    }
  }

  /deep/ .el-input__inner:focus {
    border-color: $theme-color-1;
  }
}

// grey type
.grey-class {
  /deep/ .el-input__inner {
    height: 45px;
    background-color: #f3f4f6;
    border: solid 1px #eaeaea;
    border-radius: 10px;

    .el-select__caret {
      color: #fff;
    }

    &::placeholder {
      color: #666;
    }
  }

  /deep/ .el-input__inner:focus {
    border-color: #eaeaea;
  }

  /deep/ .el-select .el-input.is-focus .el-input__inner {
    border-color: $theme-color-1;
  }

  ///deep/ .el-select .el-input .el-input__inner:hover {
  //  border: solid 1px #eaeaea;
  //}
}
</style>
